package com.smartwebx.fr.service.ckeditor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.smartwebx.fr.bean.mysql.PageFreetable;
import com.smartwebx.fr.dao.mysql.PageFreetableMapper;

@Service
@Transactional
public class PageFreeTableService {
	@Autowired
	private PageFreetableMapper pageFreeTableDao;

	public PageFreetable getPageFreeTable(String freeTabId) {
		return pageFreeTableDao.selectByPrimaryKey(freeTabId);
	}

	public Boolean copyFreeTab(String oldTabId, String newTabId, Integer pageId) {
		PageFreetable pageFreeTable = this.getPageFreeTable(oldTabId);
		pageFreeTable.setId(newTabId);
		pageFreeTable.setPageId(pageId);
		int insertNum = pageFreeTableDao.insert(pageFreeTable);
		return insertNum == 1;
	}
}
